<?php
$this->breadcrumbs = array(
	//'Materials'=>array('index'),
	'材料管理',
);

//$this->menu=array(
//	array('label'=>'List Material', 'url'=>array('index')),
//	array('label'=>'Create Material', 'url'=>array('create')),
//);
$this->userActions = array(
	array(
		'label' => '新建材料',
		'url' => array(
			'material/create'
		),
		'iconClass' => 'icon-cog-add',
	)
);
?>

<h1>材料管理</h1>
<?php $this
	->widget('zii.widgets.grid.CGridView',
		array(
			'id' => 'material-grid',
			'dataProvider' => $model->search(),
			'filter' => $model,
			'columns' => array(
				//'id',
				array(
					'name' => 'categoryId',
					'filter' => CHtml::listData(MaterialCategory::getAll(), 'id', 'name'),
					'type' => 'raw',
					'value' => '$data->category->name'
				),
				'name',
				array(
					//'name' => 'categoryId',
					//'filter' => CHtml::listData(MaterialCategory::getAll(), 'id', 'name'),
					'header'=>'其它名称',
					'type' => 'raw',
					'value' => 'implode(", ",$data->altNames)'
				),
				array(
					//'name' => 'categoryId',
					//'filter' => CHtml::listData(MaterialCategory::getAll(), 'id', 'name'),
					'header'=>'标签',
					'type' => 'raw',
					'value' => 'implode(", ",$data->tags)'
				),
				array(
					//'name' => 'categoryId',
					//'filter' => CHtml::listData(MaterialCategory::getAll(), 'id', 'name'),
					'type' => 'raw',
					'value' => 'CHtml::link("管理型号 (".$data->modelCount.")",array("materialModel/admin","materialId"=>$data->id))'
				),
				array(
					'class' => 'CButtonColumn',
				),
			),
		));
?>
